<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <title>Products Title</title>
    </h:head>
    <h:body>
        <ui:param name="title_name" value="Redigera användare"/>
		<ui:composition template="WEB-INF/templates/standard.xhtml">
			<ui:param name="page_title" value="Användare"/>
			<ui:define name="content">
				<h:form>
					<p:dataTable styleClass="datatable" var="user" value="#{usersBackingBean.users}" id="userList" rowEditListener="#{usersControllerBean.updateUser}">
						<f:facet name="header">
							Användardata
						</f:facet>

						<p:column headerText="Förnamn">
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{user.FName}" />
								</f:facet>
								<f:facet name="input">
									<p:inputText value="#{user.FName}" style="width: 95%;"/>
								</f:facet>
							</p:cellEditor>
						</p:column>

						<p:column headerText="Efternamn">
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{user.LName}" />
								</f:facet>
								<f:facet name="input">
									<p:inputText value="#{user.LName}" style="width: 95%;"/>
								</f:facet>
							</p:cellEditor>
						</p:column>

						<p:column headerText="Email">
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{user.email}" style="width: 95%;"/>
								</f:facet>
								<f:facet name="input">
									<p:inputText value="#{user.email}"/>
								</f:facet>
							</p:cellEditor>
						</p:column>

						<p:column headerText="Användarnamn">
							<p:cellEditor>
								<f:facet name="output">
									<h:outputText value="#{user.username}" />
								</f:facet>
								<f:facet name="input">
									<p:inputText value="#{user.username}" style="width: 95%;"/>
								</f:facet>
							</p:cellEditor>
						</p:column>

						<p:column headerText="# login">
								<h:outputText value="#{user.loginCount}" />
						</p:column>
						
						<p:column headerText="Options">
							<p:rowEditor />
						</p:column>
						
					</p:dataTable>
				</h:form>
			</ui:define>
		</ui:composition>
	</h:body>
</html>